$(function() {
			$.ajax({
				url : "/smarttest-frontstage/file/getProjects.action",
				method : 'GET',
				error:function(response,error){alert('error'+response.status);}, 
				success : function(data) {
					var html = data.data;
					$("#project").empty();
					$("#project").html(html);
				}
			});
});
//控制iframe全屏
$("a.jarviswidget-fullscreen-btn").bind("click", function() {
	parent.iframeFullScreen();
	//return false;
});
function getsheets(fileName) {
	$.ajax({
		url : "/smarttest-frontstage/file/getsheets.action",
		data : {filename : fileName},
		method : 'GET',
		error:function(response,error){alert('error'+response.status);}, 
		success : function(data) {
			var html = data.data;
			$("#importsheet").empty();
			$("#importsheet").html(html);
		}
	});
}
var filename;
/**
 * 上传文件
 */
function uploadFile() {
	var form = $("form[name=fileupload]");
	var options = {
		url : '/smarttest-frontstage/file/uploadCasewithuser.action',
		type : 'post',
		success : function(data) {
			filename = data.data;
			getsheets(data.data);
//			alert(data.message);
//			pageControl(false, false, false, false, true, false);
		}
	};
	form.ajaxSubmit(options);
	//$("#fileForm").submit();
}
/**
 * excel方式导入用例
 */
function importcase() {
	var sheetName =  $("#importsheet").find("option:selected").text();
	var projectId =  $("#project").val();
	if (isStrEmpt(filename)) {
		dialog('notice','请选择导入文件',3000);
	}
	else {
		dialog('loading','导入中请等待...','');
		$.ajax({
			url : "/smarttest-frontstage/file/importCase.action",
			data : {fileName:filename,sheetname:sheetName,projectid:projectId},
			method : 'POST',
			error:function(response,error){
				dialog('error','error'+response.status,3000);
				}, 
			success : function(data) {
				dialog(data.status,data.message,3000);
			}
		});
	}	
}